import React from 'react'
// 引入 react-redux 提供的hook 操作仓库
import { useSelector, useDispatch } from 'react-redux'
// 按需导入两个方法store-rtk 提供的修改数据的方法
// import { addAge, addCount } from '../store-rtk/Index'


type Props = {}
type stateType = {
    count: number,
    userinfo: {
        username: string,
        age: number
    }
}

export default function Father({ }: Props) {
    const { count, userinfo } = useSelector((state: stateType) => state)
    //console.log('state', state);

    const dispatch = useDispatch()
    return (
        <div>
            <p onClick={() => {
                // 派发任务
                // dispatch(addCount())
            }}>count:{count}</p>
            <p onClick={() => {
                // 派发任务
                // dispatch(addAge(10))
            }}>userinfo:{userinfo.username}-{userinfo.age}</p>
        </div>
    )
}